public class test8 {
    public static void main(String[] args) throws InterruptedException {
        Thread t1=new Thread(new Runnable() {
            @Override
            public void run() {
           while (!Thread.currentThread().isInterrupted()){
               System.out.println(Thread.currentThread().getName()+"我在忙着转账呢");
               try {
                   Thread.sleep(1000);
               } catch (InterruptedException e) {
                 e.printStackTrace();
                   System.out.println("有内鬼，终止交易");
                   break;
               }
           }
                System.out.println("还好发现得早");
            }
        },"李四");
        System.out.println(Thread.currentThread().getName()+"老板让李四开始转账");
t1.start();
Thread.sleep(10*1000);
        System.out.println(Thread.currentThread().getName()+"老板来电话，发现对方是内鬼");
t1.interrupt();
    }
}
